<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>生成CDK</title>
    <!-- 引入样式 -->
    <link rel="stylesheet" href="/css/backend.css">
    <link rel="stylesheet" href="/css/genCdk.css">
    <script src="/js/vue2.6.14.js"></script>
    <script src="/js/axios.js"></script>
    <!-- 引入 Element UI -->
    <link rel="stylesheet" href="/css/element-ui.css">
    <script src="/js/element-ui.js"></script>
</head>
<body>
<div class="container" id="app">
    <div class="navbar">
        <h2>生成CDK</h2>
    </div>
    <form @submit.prevent="submitForm">

        <div class="form-group">
            <label for="games">游戏(不选择默认稀有免费通用卡)</label>
            <select id="games" v-model="formData.gameId">
                <option value="">请选择游戏...</option>
                <option v-for="item in games" :key="item.id" :value="item.id">{{ item.name }}</option>
            </select>
        </div>

        <div class="form-group">
            <label for="validDay">有效期（天）</label>
            <select id="validDay" v-model="formData.validDay">
                <option value="" selected>请选择有效期...</option>
                <option key="1" value="1">1天</option>
                <option key="30" value="30">30天</option>
                <option key="90" value="30">90天</option>
                <option key="999" value="999">999天</option>
            </select>
        </div>

        <div class="form-group">
            <label for="type">卡类型</label>
            <select id="type" v-model="formData.type">
                <option key="0" value="0" selected>普通卡</option>
                <option key="1" value="1">期限卡</option>
            </select>
        </div>


        <div class="form-group">
            <label for="pwd">请输入密码</label>
            <input type="password" id="pwd" placeholder="请输入密码" v-model="formData.pwd">
        </div>

        <div class="form-group">
            <label for="count">数量</label>
            <input type="number" id="count" min="1" max="100" placeholder="请输入数量" v-model="formData.count">
        </div>



        <div class="form-group">
            <button type="submit">生成</button>
        </div>
    </form>

    <!-- 显示请求结果 -->
    <div v-if="result.length > 0" class="result-box">
        <h2>生成的CDK:</h2>
        <textarea v-model="result.join('\n')" readonly></textarea>
        <button @click="copyToClipboard">复制</button>
    </div>
</div>

<script src="/js/genCdk.js"></script>
</body>
</html>
